package main

import (
	"fmt"
	"time"
)

func printOdd() {
	var num = 1
	for num <= 5 {
		fmt.Println(num)
		time.Sleep(time.Second * 1)
		num += 2
	}
}

func printEven() {
	var num = 0
	for num <= 5 {
		fmt.Println(num)
		time.Sleep(time.Second * 1)
		num += 2
	}
}

func main() {
	// 线程1打印奇数
	go printOdd()
	// 线程2打印偶数
	go printEven()
	// 阻塞5s等待执行完毕
	time.Sleep(time.Second * 5)
}
